<?php

namespace App\Services\WeChat\Templates;

use App\Services\WeChat\MessageDispatcher;

abstract class BaseTemplate
{
    protected $dispatcher;
    protected $openid;

    public function __construct(MessageDispatcher $dispatcher)
    {
        $this->dispatcher = $dispatcher;
    }

    // 设置接收者
    public function to(string $openid): self
    {
        $this->openid = $openid;
        return $this;
    }

    // 抽象发送方法
    abstract public function send(): void;
}
